package com.laiketui.mch;

import com.laiketui.root.common.LaiKeInitFilter;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @author Trick
 */
@SpringBootApplication
@ComponentScan(
        value = {"com.laiketui.mch"
                , "com.laiketui.common"
                , "com.laiketui.domain"
                , "com.laiketui.core"
                , "com.laiketui.root.filter"
                , "com.laiketui.root.gateway"
                , "com.laiketui.root.provider"
                , "com.laiketui.root.service"
                , "com.laiketui.root.annotation"
        },
        excludeFilters = @ComponentScan.Filter(type = FilterType.CUSTOM,
                classes = LaiKeInitFilter.class)
)
@MapperScan("com.laiketui.common.mapper")
@EnableDubboConfig
@EnableTransactionManagement
@EnableAspectJAutoProxy(proxyTargetClass=true)
@DubboComponentScan({"com.laiketui.*.*.dubbo"})
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.laiketui.order.api.feign"})
public class LaikeMchApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(LaikeMchApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(LaikeMchApplication.class, args);
    }

}
